<template>

  <div class="business-list">
    <van-card
        v-for="business of businessList"
        tag="品牌"
        :title="business.name"
        :desc="business.description"
        :thumb="business.mainImage"
        @click="$router.push(`/business/detail?id=${business.id}`)"
    />
  </div>

</template>

<script>

import axios  from "axios";
export default {
  name: "list",
  data(){
    return{
      businessList: []
    }
  },
  methods:{
    _initBusinessList(){
      //本服务器下的请求不用写http://localhost:8080/
      axios.get('/ele_server/business/list').then(({data:res}) =>{
        if (res.status == 0){
          this.businessList = res.data
        }else {
          alert(res.message)
        }
      })
    },
  },
  created(){
    this._initBusinessList()
  }
}
</script>

<style scoped lang="stylus">

</style>